﻿using System;
using System.Windows.Data;

namespace compshop.Modules.ReceiveGoods.Views
{
    [ValueConversion(typeof(int), typeof(string))]
    public class ConvertDepartmentName : IValueConverter
    {
        private string[] status = new string[] { "Все", "Киев-1", "Днепропетровск-1", "Львов-1", "Одесса-1" };

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int ind = (int)value;
            return status[ind];
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string str = (string)value;

            for (int i = 0; i < status.Length; i++)
            {
                if (status[i] == str)
                {
                    return i;
                }
            }
            return value;
        }
    }
}
